package com.atguigu.yygh.hosp;/*
 * @author: XueYouPeng
 * @time: 2023/6/7 20:12
 */

import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.Date;
import java.util.List;

//泛型 ： 实体类 + 主键类型
public interface UserRepository extends MongoRepository<User,String> {

    List<User> findByAgeGreaterThan(Integer age);

    //age  > 21 order by age asc
    List<User> findByAgeGreaterThanOrderByAgeAsc(Integer age);

    //name = ？ and  age>? AND createTime < ？
    List<User> findByNameEqualsAndAgeGreaterThanAndCreateDateLessThan(String name, Integer age, Date createTime);

    List<User> findByNameLike(String name);


    List<User> findByNameEqualsOrAgeGreaterThan(String name ,Integer age);


    void deleteByName(String name);
}
